home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
utils1
/
get26.arj
/
GET26NEW.DOC
< prev
next >
Wrap
Text File
|
1994-01-14
|
45KB
|
911 lines
GET26NEW.DOC - New features in GET.EXE 2.6a - Copyright 1994 Bob Stephan
This file summarizes the new and improved features in GET.EXE Version
2.6a. If you have been using an older version of GET, read this
file to find out what has been changed, and what has been added.
GET 2.6a fixes a minor bug in GET 2.6 and adds an important note
below for GET K, Q, and L when run in an OS/2 DOS session! See GET K.
The file you obtained should be GET26UPD.ZIP. It ia an upgrade
version of Bob Stephan's BATch Enhancer, GET.EXE, Version 2.6a. It
is not authorized to be used except in conjunction with the documen-
tation included with the previous release, GET.EXE Version 2.5.
All warranty and licensing provisions in the documention for Version
2.5 apply to Version 2.6a except as modified herein. The new features
in this version were selected because they were requested by users.
GET Version 2.6a is distributed as GET26.EXE so as to not inadvertently
overwrite previous versions. Rename GET26.EXE to GET.EXE when you are
ready to replace older versions.
Pricing, licensing, and copyright.
---------------------------------------------------------------
GET 2.6a is released as shareware with a requested registration fee of
$15 plus $1 shipping and handling to U.S.A, Canada, or Mexico, or $3
to other foreign countries. GET26UPD is released as an upgrade with no
manual included in the shareware package other than the information in
this file. Registered license holders of GET 2.5 are eligible to receive
a registered copy of the 2.6a upgrade FREE with an option to buy the
full 2.6a manual for $6+S&H when available. The full manual which we
intend to have commercially printed can be included with new
registrations for $6 or ordered later by registered users for $6 plus
S&H as above. These prices are subject to change. Unfortunately,
economics preclude us from continuing the free upgrade policy from
Version 2.6a and subsequent releases, but registered users will be
able to obtain upgrades at very reasonable prices. See ORDER.GET for
additional pricing information.
After the release date of Version 2.6a, users sending in registrations
from the older versions still in circulation will receive both 2.5
and 2.6a with documentation on disk, but no printed manual. Read
the file README.DOC before printing out the Version 2.5 manual.
Information regarding the display of the Copyright notice: We have
attempted to make it so the notice will be displayed once and only
once at the first call to GET after the computer is booted. GET
checks the Environment block to determine whether it has been run
prior to the current call. If there is a GET= or a G$$= variable
in the Environment, the copyright notice will not be displayed.
If neither of these variables is present, GET will display the
copyright notice, and then will create a G$$= variable to keep
itself from displaying the notice subsequently.
You can avoid the creation of the G$$= variable by ensuring that
there is always a GET= variable in the Environment whenever GET is
called. This is not always easy to control, however. Note that a
timeout for GET C /Wn or GET S /Wn will result in no value for the
Environment variable. This is also true for GET S and GET Z[E] if
the string to be put in the Environment is empty such as when nothing
but a return has been pressed. The G$$= variable takes only 7 bytes
of Environment space, so it is probably easier to just let GET create
it rather than trying to ensure there is always a GET= present.
The runtime version does not display the copyright notice unless
it is called with no valid arguments. The runtime version for
registered users is approximately 5K in size.
New and modified features.
---------------------------------------------------------------
The GET command information below is arranged alphabetically
according to the GET command character. But first, a discussion
of new and changed switches and a few miscellaneous items.
Switches.
-----------------------------------------------------------------
The #num syntax is eliminated along with the surrogates that have
been replaced by the /X, /E, and /C switches. #num and its ilk
are all replaced with /Wnum. The extended, enhanced, and break
surrogrates are all replaced with the switches that were intro-
duced in Version 2.5. The older syntax was supported in 2.5 for
compatibility, but will no longer work in 2.6a.
$num indicates that num is in Hexadecimal if a number is expected.
This is useful for GET R and GET B, and can be used any place a
numerical arg or parameter is expected.
Now the # sign works as a prefix to an ASCII character and means use
this character as a number. Thus you can perform arithmetic using
the numerical value of ASCII characters. The # character, like the
$ character for hex, can be used wherever numerical input is
expected; however, with the # character only one character
immediately following it is converted to the ASCII value of that
character. These conversions will be most useful with GET R.
The /~ switch for GET S is being phased out, and replaced by /X (for
Xcape). The operation of GET S with the /X switch has been
enhanced. When /X is specified, if the user presses Escape, the
Escape surrogate will be the result, and if the user presses Return
(Enter) before pressing any other keys, the CR surrogate will be
the result. A timeout will produce a 0 (zero) result. If /X is
not specified, all three of these user actions will produce a 0
result.
/H provides a generalized Hexadecimal capability. Whenever numerical
output is expected in the Environment, /H will convert the output
to Hexadecimal. For GET F, /X will still report the full filesize
in hex even if the errorlevel is in kilobytes (/A not being used),
while /H will report kilobytes in hex unless /A is being used.
/N is a new switch to suppress the carriage return after a prompt.
This works with any command that issues a prompt, including ECho
(GET EC). Use with caution. If the prompt is on the bottom
line of the screen and the /A switch is being used, DOS may pick
up the prompt attribute as the new screen attribute as it scrolls.
Various video BIOS's may produce different results.
The /T (Trim) switch by itself (not /TR or /TL) will trim both left
and right. You can also use /TB to trim both. Trim will now also
trim Alt-255 characters (as upper case spaces).
/R, a new switch, will force the Return Code into the Environment for
any GET command instead of the normal Environment result.
EXAMPLE: Use GET to estimate the number of minutes it will take to
transfer a file at different transmission speeds. Since the /Wdiv
switch for GET F only affects the ErrorLevel, we can use /R to put
the resulting value in the Environment also. However, the divisor
would be too large at 9600 and 14400, so some preliminary math is
used in the 9600 and 14400 calculations. To keep it simpler, no
adjustments are made if the file is larger than 655360.
@echo off
if "%1"=="" goto HELP
Rem Get file size in bytes, store in SIZE=
GET F %1 /VSIZE= /A
if "%SIZE"=="" GOTO NOTFOUND
if "%SIZE%"=="*" GOTO TOOBIG
echo Minimum transfer time for a file size of %SIZE%
GET F %1 /r /w7200 /a
echo at 1200 bps = %GET% minutes
GET F %1 /r /w14400 /a
echo at 2400 bps = %GET% minutes
Rem Get file size in Kilobytes (*1024)
Rem SIZE/1060*60 ≈ SIZE/1024*62
GET F %1 /W62 /R
echo at 9600 bps = %GET% minutes
Rem SIZE/1650*60 ≈ SIZE/1024*97
GET F %1 /W97 /R
echo at 14400 bps = %GET% minutes
GOTO END
:NOTFOUND
Echo File %1 not found.
GOTO HELP
:TOOBIG
Echo File %1 is too large. Max size is 655360.
:HELP
Echo The argument (%%1) is a file specification
Echo bps = bits per second, cps = characters per second
Echo for 12-2400, we use 10 bits / character (8 + start + stop)
Echo for v.32, we est 8-9 bits / character
Echo therefore
Echo 1200 bps = max of 120 cps
Echo 2400 bps = max of 240 cps
Echo 9600 bps = est of 1000-1100 cps, use est 1060
Echo 14400 bps = est of 1600-1700 cps, use est 1650
:END
SET SIZE=
SET GET=
/S, a new switch for sound control, has been added. For this
release, the only effective format is either /S or /S0 to turn
off the beeps for various alerts, such as striking an invalid
key, or getting a time-out.
A revised method for locating the master environment for the /M
switch has been implemented. It is hoped that this will work in
those few instances where the old method failed. Testing with
DESQview indicated that it would work with MS DOS but not with
DR DOS. However, when it works, it finds the Environment for
the original command processor that loaded DESQview, not for
any command processors running in the DV window. It might
work similarly with Windows, but it hasn't been tested.
The maximum length of the input string for GET S and GET ZE has
been increased from 79 to 127.
/W is now defined to be the same as /W0. This has implications for
functions such as C, S, N, W, and R. See GET R below.
When numerical input is used for an argument or with /W, the
numbers can now be as large as 65535. Previously they were
limited to 4 digits.
Miscellaneous features:
---------------------------------------------------------------
All waiting periods should work for Windows DOS multitasking.
The DOS "idle interrupt" is called to permit multitasking in
these environments. It has always worked in DESQview and OS/2
DOS sessions.
The help screen can exit at the --More-- pause. It will time out in
10 seconds and go to the next screen. Press Esc to exit at this
point, or any key except space, CR, or Esc to cancel the timeout.
PgUp can be used to return to the first screen and start over.
If a value is too large for the division method used to convert it
to an Environment variable, only a single asterisk will be stored
as the Environment value instead of adding an asterisk to an
invalid value. The asterisk means that the value is larger than
655,530. Previously the values stored were not very meaningful,
and the new method makes it easier to test for a large value.
When a character argument (the arg not in double quotes) is called
for, it can now be enclosed in single quotes ("'"s, apostrophes). To
include a single quote in the argument, use two apostrophes next to
each other. There must always be an even number of quote symbols.
'' by itself is the same as no argument at all. To specify exactly
one quote and nothing else use ''''. Quoting permits including a space
in the argument for GET C, for example. Since you cannot test for a
space with IF, if user enters space it will be reported as ASCII
255 unless /L is used. A quoted argument can be useful with GET #
below. The single quote is usually on the same key with the
double quote character, and should not be confused with the grave
accent or "back quote" character which is often on the same key
as the tilde.
Also removed is the error message if a version of DOS less than
2.0 is detected. This is considered to be a highly unlikely
event, so it will result in simply the "Invalid command" message.
Some features of Version 2.6a require DOS 3.0 or later.
GET is sensitive to the number of spaces between GET and the
command character. There must be one and only one space
following GET. This will be improved in a future release.
GET COMMANDS in ASCII alphabetical order.
GET #[E] Locate a substring in a string
---------------------------------------------------------------
GET # is like the BASIC INSTR (In String) function. It locates the
position of a substring within a string. The syntax is:
GET # "string" 'sub' [/Woffset] [/x] [/Trim]
/x starts the search at the end of the string from right to left.
The substring comparison is still left to right, and the position
reported is the offset from the beginning of the string.
The result is 0 (zero) if the substring is not found in the
string, else it is the location starting with 1 for the leftmost
character. If no 'sub' is given, the length of string will be
reported. If /Woffset is specified, the search will begin at the
offset specified; thus, a second or subsequent occurrence can be
found. If /x is specified, the offset is counted from right to
left. The search is case sensitive.
Notes: for GET # you cannot include the single quote character
(apostrophe) in the substring.
Examples: Command Result
GET # "D:\subdir\filename.ext" '\' 3
GET # "D:\subdir\filename.ext" '\' /w3 10
GET # "D:\subdir\filename.ext" '\' /x 10
GET # "D:\subdir\filename.ext" '\' /x/w10 10
GET # "D:\subdir\filename.ext" '\' /x/w13 3
GET #E uses the GET # arguments to Extract the string.
After skipping /Wn characters, the substring up to but not
including 'arg' will be extracted. The ErrorLevel is the length
of the extracted substring.
If /X is specified, the substring in 'arg' plus everything to the
right except the first character will be extracted. On the
basis that it is easier in BATch files to catenate strings rather
than shorten them, the first character of the target string is
likely to be a delimiter of some sort, for example the '\' in a
filespec, or the white space between words. The below
examples demonstrate how easy it is to extract portions of a
filespec.
Examples: Command Result ErrorLevel
GET #E "D:\subdir\filename.ext" ':' D 1
GET #E "D:\subdir\filename.ext" '\' D: 2
GET #E "D:\subdir\filename.ext" '\' /w3 subdir 6
GET #E "D:\subdir\filename.ext" '\' /x filename.ext 12
GET #E "D:\subdir\filename.ext" '.' /x ext 3
GET #E "D:\subdir\filename.ext" '\' /x/w10 filename.ext 12
GET #E "D:\subdir\filename.ext" '\' /x/w13 subdir\filename.ext 19
Note: There may be a confusing difference between the use of /Wn
for GET Z[E] and GET #E. For GET Z /Wn specifies the maximum width.
For GET # /Wn specifies the offset to start the extraction. In
retrospect it would seem to be better to reverse the meaning of 'arg"
and /W for GET Z[E], but this would make it incompatible with the
previous release.
The /T trim switches can be used to trim blanks and Alt-255
characters from either or both ends of the extracted string.
GET 4, GET DV 4DOS and DESQview Versions
---------------------------------------------------------------
DESQview and 4DOS Version numbers. GET DV reports the DESQview
Version number if it is running, otherwise 0. GET 4 reports
the 4DOS Version number if it is running, otherwise 0. The
4DOS Version number only indicates that 4DOS is in memory, not
necessarily that it is the parent of the BATch program, but you
can check for that with the test given in the 4DOS manual:
if not "%_cwd%"=="" echo 4DOS is loaded!
GET AE ROM BIOS Model
---------------------------------------------------------------
GET AE returns additional information in the Environment. In
addition to the 2-byte machine code, there is a space, then the
8-byte BIOS date.
GET B Blank Screen [using a color]
---------------------------------------------------------------
GET B can now use the same attributes with /A that the prompt uses.
The /W switch can be used with GET B to set the number of roWs
on the screen for EGA or VGA monitors. GET B /W25 sets the
screen to 25 line mode. GET B /W43 sets EGA screens to 43 line
mode, and VGA screens to 50 line mode. If the /X switch is used,
GET B will return the current number of lines on the screen
instead of the video attribute. This is done by using a BIOS
call to load either the default 8x14 or 8x8 font table. Your
number of lines may vary depending on your EGA or VGA BIOS. To
get 25 line mode, it may work better to use GET V 3 to set video
mode 3 instead of GET B /W25.
GET BE will still work the same, and the number will be taken to
be in hex whether it has a $ or not with the Environment value in
hex. GET B can take a $hex number as input but will report in decimal
unless /H is used.
GET D DOS Version
---------------------------------------------------------------
GET D now puts 20 in the Environment for OS/2 major version. Also,
GET DE will put a 2 digit minor in Environment (but not in ErrorLevel).
GET E Environment Space
---------------------------------------------------------------
Information about the Environment space with GET E has been enhanced
to provide the full size as an eXtra function with /X. GET E or
GET EE with the /X switch will report the total bytes in the
command processors Environment. If you are running under a
secondary command processor, GET E or GET EE with the /M switch
will report Environment information for the master Environment.
One way to use this information is to be able to enlarge the
Environment space available if GET E reports too little to do what
you want to do. For example, suppose you need 100 bytes of
Environement free, but GET E tells you there are only 50 bytes
available. You can then find the total size of the Environment,
and recursively invoke the command processor with the new size
that you will need after finding out how big it was originally.
EXAMPLE: You need 100 bytes of Environment free:
GET E
Rem First time GET reports ErrorLevel : 50
Rem Then the second time through with enough space branch to CONTINUE
IF ErrorLevel 100 goto CONTINUE
GET E /X
Rem Check for error to prevent infinite loop.
IF not ErrorLevel 1 GOTO END
Rem Add 112 bytes to original Env size. (use a multiple of 16).
GET R "+" %GET% /W112
Rem Invoke a new command processor with increased Env and run BAT file.
%COMSPEC% /E:%GET% /C%0 %1 %2 %3 %4 %5
Rem When the secondary command processor terminates, it will have
Rem run this BATch file, so now we must exit.
GOTO END
:CONTINUE
Rem Do your thing here.
:END
A subtle change in the operation of GET E that may be useful.
Previously, it did not remove the GET variable from the
Environment before measuring the space remaining, even though it
overwrote it later with the new GET variable. Now it will
remove the GET or other variable specified with /V for GET E
before measuring. That gives a better measure of how much space
is available for GET variables. To make it work as it did before,
just specify a variable that is not already in the Environment
with the /V switch. As usual, /V- will suppress any changes to
the Environment.
For the old method it would have been necessary to call GET twice
or remove any existing GET variable from the environment with
SET GET= to get a more accurate measure of the Environment space
available for GET to work in. To provide for sufficient free
Environment space in the event the BATch file is being run from
a "shell" you can now SET GET=(a large variable) in your AUTOEXEC or
before loading the shell (PC Shell, Xtree, etc.), and when GET
measures the environment it will clear out the GET variable and
give you an accurate reading.
GET EC Echo [with attribute]
---------------------------------------------------------------
An "echo" feature was added. This can be effected by calling GET EC
with a "prompt" such as: GET EC "Hello".
The advantages to using this instead of GET I "Hello" for example,
are that the echo feature can be redirected. The ending carriage
return can be suppressed with /N. If you want to Echo a printer
command, for example, you can do it with GET EC "Esc command">PRN /N.
An ANSI.SYS command can be echoed with GET EC "Esc command" /N
GET F File Size or Date/Time
---------------------------------------------------------------
GET F can now return the File DATE and/or TIME. This feature has
been requested by quite a few users so was added to this release at
the last minute. The syntax is:
GET F[E] filename /E [/Wn]
The /E switch specifies that GET F return the date instead of the
file size. The number n in /Wn uses the same coding as GET H to
return the date/time information; i.e. 2=Day of the Month, 4=Month,
8=Year, 16=Minute, and 32=Hour. These are the only valid codes.
The default is 2 for Day of the month. In other respects,
GET F[E] /E works the same as GET H[E] for reporting the date
information, and the format will be the same as for system date/
time information as reported by GET H. International date/time
formats have not been implemented in this version, but will be in
a future version.
NOTES: Previously GET F /E worked the same as GET F /X. This has
been changed and any BATch programs that used GET F /E must be
changed to use GET F /X instead.
GET F does not open a subdirectory as a file and therefore cannot
obtain the date of a subdirectory. For GET F ... /E, if the filespec
is a subdirectory, the ErrorLevel will be 0 and the Environment variable
will be empty. Root directories will probably return the same
result, but see information on root directories below.
GET F filespec /A is for small files and reports the full size in the
Environment, and in the ErrorLevel (max 255) unless reduced by /Wdiv.
For GET F, /X will still report the full filesize in hex even if
the errorlevel is in kilobytes (/A not being used), while
/H will report kilobytes in hex unless /A is being used. Sorry
if this is a bit confusing.
GET F must open the file for reading in order to obtain the
requested information. This means that GET F may fail on files
that cannot be opened in this manner. Although special handling
is implemented for directories (which GET cannot open as files),
there are other cases where GET may return the code 5 meaning
"Access denied". Such cases include, but may not be limited to
files on network drives for which read access has not been
granted, files opened by other processes, volume label names, and
possibly root directories in older versions of DOS. The
following return codes are of particular interest for GET F.
2 for "File not found"
3 for "Path not found" (this may also be returned for an
invalid drive specification).
5 for "Access denied"
15 for "Invalid drive"
GET F will accept a root directory specification and treat it the
same as a subdirectory by reporting an ErrorLevel of 0 and setting
the Environment variable to 0 also. However, since the root
directory is not a file, the result may be dependent on the version
of DOS. It has only been tested with MS-DOS 5.0 and may work
differently on older versions of DOS. If your application may
sometimes use GET F for a root directory, test it with all versions
of DOS that it may encounter to determine the results that will be
reported. If an invalid drive is specified in the filespec, the
ErrorLevel will probably be 3 (path not found) and the Environment
variable will be empty. Remember that GET F does not check for a
valid disk in the drive, so if you are checking A: or B: and
there is a chance that there may not be a formatted diskette in
the drive, use GET K, Q, or L first to verify it. Checking for
a formatted diskette each time would slow GET F down with the
extra overhead which is unnecessary in most cases.
GET F will also accept the \ as the last character of the filespec if
it is a directory. A trailing \ will be ignored, so it doesn't
necessarily specify a directory. For a root directory, the \ is
required.
GET H System Date and Time
---------------------------------------------------------------
GET HE has been changed to display a 4-digit year if code 8 is
included in the argument. This permits years later than 1999 to
be reported and used. Note: 4DOS Version 3.xx DATE command will
not accept a 4-digit year. 4DOS Version 4+ works OK.
The ErrorLevel for Year is Year-1900, thus 2000 will be 100, etc.
The code 256 was added to specify the result to be 100ths of seconds
Codes 128 and 256 work only with GET H, not GET HE. Also remember
that code 128 is the only one that can be combined with another
code for GET H since GET H returns a single result.
GET HE now will check for a /A switch, and if found will not
substitute a leading blank for a leading 0.
EXAMPLE: Display the Day of The Week for any date between
1-1-1980 and 12-31-2099, then reset the current date.
@echo off
set TRY=%1
if not "%1"=="" goto TryDate
get s "Enter mm-dd-yyyy: " 99-99-9999 /VTRY=
:TryDate
GET HE 14 /vDAY=
date %TRY%
GET H 1
date %DAY%
goto DAY%GET%
:DAY6
set DOW=Satur
goto END
:DAY5
set DOW=Fri
goto END
:DAY4
set DOW=Thurs
goto END
:DAY3
set DOW=Wednes
goto END
:DAY2
set DOW=Tues
goto END
:DAY1
set DOW=Mon
goto END
:DAY0
set DOW=Sun
:END
Echo Day of the week for %TRY%: %DOW%day
:EXIT
Set TRY=
Set DAY=
Set DOW=
Set GET=
New waiting time features in GET H!
GET H (Horological) /W option revised.
/Wnum now means wait for the given number of seconds, then report.
/X/Wnum means wait until a minute in 24 hour time, then report.
NOTE: The 24 hour time specification must be in military format,
no punctuation; e.g., 1135, 0300, 1056, etc. Use 2400 for
midnight, not 0000.
In either case the wait cannot be longer than 18 hours (65535
seconds). If the 24 hour time is longer than 18 hours hence,
it will be reduced to 18 hours. If a number of seconds greater
than /W65535 is specified, the results are unpredictable. If the
24 hour time specification is less than the current time, it will
be interpreted as meaning going past midnight to the given time
on the next day. Internally GET C is used to process the waiting
time, thus the wait can be interrupted by pressing any key. If a
"prompt" is included, it will be displayed during the wait. Any
switches will be used for GET C also, thus /A can be used to
control the attribute of the prompt. However, no character 'arg'
will be recognized, so any key will interrupt the wait.
Although it was possible to accomplish the same thing with GET C /W
in previous versions, this feature will make it easier and more
precise to specify waiting times in BATch files. If necessary to
wait more than 18 hours, more than 1 call to GET can be used to wait
various lengths of time, each no more than 18 hours.
EXAMPLES:
1. Wait until 11:30 p.m. the same day.
GET HE "Waiting until 2330" 112 /x /w2330
Rem the prompt is displayed while waiting.
Rem Waiting until 2330
REM After the appropriate wait the results of GET HE 112.
The Environment is: 23:30:00
The ErrorLevel is: 8
2. Wait until 3 a.m. the next day (or the same day if after midnight)
GET HE 112 /x /w300
The Environment is: 03:00:00
The ErrorLevel is: 8
3. Wait for 3600 seconds (1 hour). Starting time: 11:30 a.m.
GET HE 112 /w3600
The Environment is: 12:30:00
The ErrorLevel is: 8
GET K, GET L, GET Q Disk Space and Label
---------------------------------------------------------------
Commands GET K, Q, and L have been modified to use a different procedure
to check for a formatted floppy disk in a drive. This procedure is
much faster if there is a disk in the drive that is not formatted.
As before, if it cannot be determined if a formatted disk is in the
drive, the ErrorLevel will be 0, and an error code will be in the
Environment. The error codes that will probably be returned may be
different than previous versions of GET as follows (in hexadecimal):
1 Invalid drive specified - this new procedure works only for
drives on the primary disk controller, usually A: and B:.
2 Address mark not found meaning disk is not formatted
6 Floppy disk has been removed. If this code is returned, try
again since it may persist even if the drive door has been
opened and closed again, especially if a disk cache is in use.
20 Controller failed meaning disk is not formatted.
80 Drive timed out probably because door is open
Other codes that may be seen - test on your system:
3 disk write protected may mean no diskette in drive.
4 sector not found - possible if disk is not formatted.
8 and 9 DMA errors (unlikely)
C media type not found - possible if disk is not formatted.
10 data error - formatted disk in drive but is unreadable
40 seek failed (unlikely) .
NOTE: A bug in the initial release of version 2.6 reported an error
code of 180 instead of 80 in some cases. This has been fixed in 2.6a.
Also the above codes were given in decimal but are reported in hex,
so the above documentation has been changed to the hex values.
IMPORTANT NOTE: It has recently been discovered that these functions
appear to have a problem when run in an OS/2 DOS session. This
problem does not show up in DOS, nor does it show up in GET 2.5 which
uses a different but slower method to check for a readable diskette.
This problem is under investigation; however, these functions must
be considered unreliable for an OS/2 DOS session. If your
application might be run under OS/2 it is recommended that you use
GET 2.5 for these functions. Please advise us if this is a serious
problem for you and we will do everything we can to supply you with
a solution for the problem as soon as it is resolved.
GET P Printer Status
---------------------------------------------------------------
Customized printer status tests. GET P[E] will accept a
numerical arg representing a byte value. This value will be
"and"ed with the printer status byte, and the result returned
in the ErrorLevel and the Environment. If a numerical arg is
present GET PE will not affect the status of PrtSC, but it
will still attempt to initialize the printer. Note that if you
are using a print spooler or buffer, all bets are off. Everything
depends on what is returned in response to Int 17h, Service 02.
Printer status items that can be tested for. Sum the values to
test for the items desired.
Value Hex Item
1 $1 Time-out
8 $8 I/O Error
16 $10 Printer selected
32 $20 Out-of-paper signal
64 $40 Acknowledgement from printer
128 $80 Printer not busy (0 means busy)
For GET PE only, the /X switch will force disabling of PrtSc
whether a printer is attached or not.
EXAMPLES:
1. GET P 255 will return a value representing the sum
of the values of all 1-bits in the printer status byte.
2. GET P 144 will indicate with either 0 or 144 whether the
printer is available and ready for data.
3. Disable Shift-PrtSc:
GET PE /X
Enable Shift-PrtSc again but only if the PE test is 1:
GET PE
GET R 'Rithmetic
---------------------------------------------------------------
GET R ('Rithmetic) has the following new features. The arithmetic
symbol must be entered as the "prompt" argument.
Syntax: GET R ["+-*/!=#"] [num1] [/Wnum2] [/H]
The defaults for num1 and num2 are 0 (zero).
/H reports the final Environment result in Hexadecimal
Symbols: "+" the default, adds the two numbers.
"-" subtracts num2 from num1
"*" multiplies the two numbers. The maximum product is
655,350. If the multiplication produces a larger
product an asterisk will be used to
indicate that the result is too large.
Note num2 defaults to 0, so if it
is not specified, the result will be 0.
"/" divides num1 by num2 by integer arithmetic. Only
the quotient is returned. See NOTE below.
"!" modulo arithmetic. Divides num1 by num2 and returns
only the remainder.
NOTE: Division by zero is invalid. If num2 is omitted,
or is 0, the result will be num1 for "/" or "!".
If num1>255 the result will be num1 modulo 256.
"=" compares num1 and num2 and returns one of:
0 if num1<num2
1 if num1=num2
2 if num1>num2.
This makes it easy to use ErrorLevel to check for
>= or <= as well as one of the above.
When numerical input is used for an argument or with /W, the
numbers can now be as large as 65535. Previously they were
limited to 4 digits.
$num indicates that num is in Hexadecimal if a number is expected.
This is useful for GET R, GET B, and can be used anyplace a
numerical arg or parameter is expected.
Now the # sign works as a prefix to an ASCII character and means use
this character as a number. Thus you can perform arithmetic using
the numerical value of ASCII characters. The # character, like the
$ character for hex, can be used wherever numerical input is
expected; however, with the # character only one character
immediately following it is converted to the ASCII value of that
character. These conversions will be most useful with GET R. GET R
/H provides a generalized Hexadecimal capability. Whenever
numerical output is expected in the Environment, /H will convert
the output to Hexadecimal.
The /A (for ASCII) switch in the case of GET R, means put the
ErrorLevel in the Environment as an ASCII character.
EXAMPLES:
1. Convert a hexadecimal number to decimal
GET R $ABC
The Environment is: 2748
The ErrorLevel is: 188
NOTE: Since the ErrorLevel is limited to a max of 255, the result
is reported modulo 256.
2. Add a hexadecimal number to a decimal number
GET R 10 /W$A
The Environment is: 20
The ErrorLevel is: 20
3. Add a hexadecimal number to a decimal number, result in hex
GET R 10 /W$A /h
The Environment is: 14
The ErrorLevel is: 20
4. You want a single digit for the month to use in
constructing a filename. Suppose the month is December.
GET H 4 /H
The Environment is: C
The ErrorLevel is: 12
5. Suppose you want a series of characters A, B, C, D, E to
construct 5 filenames. With the new methods only one call to
GET within the loop is necessary.
Rem Establish starting point of first character - 1.
GET R "-" #A /W1 /VC= /A
Rem Convert the value for the last character.
GET R #E /VN=
:NAMELOOP
Rem Convert last char to num, add 1, and convert back to char.
GET R "+" #%C% /W1 /VC= /A
Echo Character %C% can be used in a name.
IF NOT ERRORLEVEL %N% GOTO NAMELOOP
SET C=
SET N=
6. Convert a hexadecimal number to an ASCII Character
GET R $4F /A
The Environment is: O
The ErrorLevel is: 79
7. Add a hexadecimal number to an ASCII Character, and convert
the result to an ASCII character.
GET R #A /W$A /A
The Environment is: K
The ErrorLevel is: 75
8. Add a hexadecimal number to an ASCII Character, result in hex
GET R #A /W$20 /h
The Environment is: 61
The ErrorLevel is: 97
GET S Get String
---------------------------------------------------------------
GET S has additional Exit key features.
When /X is specified, if the user presses Escape, the Escape
surrogate will be the result, and if the user presses Return (Enter)
before pressing any other keys, the CR surrogate will be the result.
A timeout will produce a 0 (zero) result. If /X is not specified,
all three of these user actions will produce a 0 result.
/E turns on function keys as Exit keys. If the user presses
a function key (F1-F10 only), and if /E is specified, then the
surrogate code (100+scan code) for that function key will be
reported. /E includes /X, so both are not needed. /E does not
turn on Enhanced keys in this case, it only enables F1-F10.
This permits something like "F1 for help" to be used.
The /~ switch for GET S is being phased out, and replaced by /X (for
Xcape). If used with GET?=ON a warning will be displayed.
The maximum length of the input string for GET S and GET ZE has
been increased from 79 to 127.
GET W Warm/Cold Boot
---------------------------------------------------------------
GET W will now take a prompt. If a "prompt" is specified, the code
for GET C is called to wait for a character to be entered. The
switches for GET C including /W, /C, and /A can be used. If /C is
not specified the user can break out with Ctrl-Break or Ctrl-C.
To prevent this, use /C. When a valid character is entered, the
specified type of reboot will be initiated. Using a prompt
nullifies the effect of an argument which modifies GET W to just
try to determine whether the last boot was warm or cold. As with
GET C, if an invalid character is entered, the waiting time will
be infinite.
GET X Return Code from Execution of Program
---------------------------------------------------------------
GET X provides a method of getting the return code (ErrorLevel) from
a program into the Environment. The syntax is:
GET X "d:\path\program.ext" ' progargs' [/switches]
where "program" is the name of the program you want to run. It
must be fully qualified with drive, path, and extension of either
.COM or .EXE (no BATch files). The exceptions are if the program
is on the current drive, or in the current directory, in which
cases drive and\or directory will default to current. Do not
include any spaces inside the double quotes. You can use .. for
the parent directory of the current subdirectory, and . for the
current directory, however the latter is not needed since it will
default to the current directory.
' progargs' are the arguments, parameters, and switches for the
program you want to run. Many programs require that the first
character in the "command tail" be a space, so it is good practice
to start the argument string with a space. It is also good
practice to enclose the progargs in single quotes, however if no
spaces are included, the quotes are not absolutely necessary.
[/switches] are the optional switches for GET, such as /M for the
master environment, or /V to designate the variable name. Any
switches for the program must be included in progargs.
If GET X is successfull in loading and running the designated
program, the ErrorLevel from the program will be in both the
Environment and the ErrorLevel when GET terminates.
If GET X is not successful, the Environment variable will be
empty, and the ErrorLevel will contain a reason for the failure:
2 File not found - check the file specifications.
3 Path not found - check the drive and path information
4 Too many open files
5 Access denied - check for proper .COM or .EXE extension
8 Not enough memory
If the "child" program terminates abnormally, there will be no
Environment variable, and the ErrorLevel will be one of the
following:
21 Child program was terminated by Ctrl-C or Ctrl-Break.
22 Critical device error - e.g. answering "a" to "Abort,
Retry, Fail".
23 Child program stayed resident as a TSR. This should never
happen because you should not load a TSR in this manner.
GET XE places the eXecution path of GET.EXE in the Environment,
including the drive, path, name, and extension of the file and
location from which GET is executing. The ErrorLevel will be the
ASCII code of the drive; e.g. 65 for A, 66 for B, etc. This can
be useful on an installation disk to determine the drive from
which the installation program is running. Requires DOS 3+.
GET Z Zap (Additional String Handling)
---------------------------------------------------------------
GET Z. The <skip> argument works for GET ZE as well as GET Z.
/X with GET Z[E] now means to extract from the right. The skip
arg skips from right to left, and the /Wn takes n chars from that
position. GET ZE works the same as GET Z now, except for the
source of the string. Z takes the string from the "prompt", and
GET ZE takes the string from standard input.
NOTE: You can save the length of a string as an environment
variable with GET # above, or with GET Z with /R (see above).
EXAMPLE: Extract the minutes and seconds from the DOS TIME
command.
GET U 13
TIME >TIME.DOS
GET ZE 22 /W5 <TIME.DOS >NUL
NOTE: This is not a reliable method if any users might be using
DR DOS or 4DOS which have a different format for TIME and DATE.
If you use GET Z or ZE with /W1 to extract a single character, the
ASCII decimal value of the character will be in the ErrorLevel (or
0 if the extraction failed). Previously GET dutifully reported an
ErrorLevel of 1 meaning that you extracted one character, but you
already knew that so it wasn't very useful. Reporting the value of
the character provides additional information, and may save another
call to GET to make that determination.
Furthermore, for GET Z only, if both /W1 and /A (for ASCII) are
specified, the ASCII decimal value will be spelled out in the
Environment also. This allows it to be available to another BATch
command, or another GET command such as GET R. If the extraction
fails such as because the string is empty, or you skip too far,
then the Environment variable will still be expunged.
-----------------------------------------------------------------------
If you have any questions, comments, or suggestions please contact us:
MOBY DISK: 1021 San Carlos Road, Pebble Beach, CA 93953
Phone: (408) 646-1899 COMPUSERVE:72357,2276 Prodigy: FNGC05A
Internet: bob.stephan@nitelog.com BBS: Nitelog 408-655-1096
BBS: The Cricket 408-373-3773 /s/ Bob Stephan January 14, 1994